<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="format-detection" content="telephone=no" />
    <title>转让</title>
    <link rel="stylesheet" href="../../css/reset.css">
    <style>
        body {
            width: 100%;
            background-color: #fff;
            font-size: 0.28rem;
            height: auto;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            font-family: PingFangSC-Regular, sans-serif;
            color: #333333;
        }

        .flex {
            display: flex;
            display: -ms-flex;
            display: -webkit-flex;
            display: -moz-flex;
        }

        input {
            border: none;
            outline: none;
        }

        .showDetail {
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            background-color: #fff;
        }

        .showDetail li {
            width: 100%;
            height: 1.2rem;
            padding: 0 0 0 0.24rem;
            box-sizing: border-box;
        }

        .showDetail li p {
            width: 100%;
            display: flex;
            display: -webkit-flex;
            height: 100%;
            align-items: center;
            justify-content: space-between;
            font-size: 0.27rem;
            padding-right: 0.24rem;
            box-sizing: border-box;
        }

        .showDetail .limitText {
            line-height: 0.68rem;
            height: 0.68rem
        }

        .showDetail li:last-child>p {
            border-bottom: 0;
        }

        .showDetail li p span:last-of-type {
            font-weight: 500;
            font-size: 0.26rem;
            color: #181818;
        }

        .limitText {
            justify-content: flex-end;
            color: #ffa6a6;
            background-color: #f7f7f7;
            align-items: center;
        }

        #showButton .rentNumber input {
            display: inline-block;
            width: 1.45rem;
            height: 0.68rem;
            line-height: 0.68rem;
            text-align: right;
            color: #878787;
            margin: 0 0.1rem;
            font-size: 0.28rem;
        }

        .rightData {
            align-items: center;
            -webkit-align-items: center
        }


        .showDetail li p>span>.dw {
            font-size: 0.25rem;
            color: #ffd203;
            padding-left: 0.1rem;
        }

        .showDetail .hideBorder {
            height: 0.2rem;
            background: #f7f7f7;
            display: none
        }

        .choseTitle {
            padding: 0 0.24rem;
            background: #f7f7f7
        }

        .choseTitle>span:first-child {
            font-size: 0.22rem;
            color: #b1b1b1;
            line-height: 0.68rem;
        }

        .choseTitle>span:last-child {
            font-size: 0.22rem;
            color: #181818;
            line-height: 0.68rem;
            float: right
        }

        .payWay_Box {
            padding: 0 0.24rem;
            background: #fff;
        }

        .payWay_Box {
            color: #181818;
        }

        .payLogo {
            width: 0.56rem;
            vertical-align: middle;
            margin-left: 0.1rem;
            margin-right: 0.22rem
        }

        .payWayTxt {
            font-size: 0.27rem;
        }

        .this_leastM {
            font-size: 0.24rem;
            padding-left: 0.1rem
        }

        .choose-item {
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            padding-left: 0.24rem;
        }

        .choose-item>span {
            width: 100%;
            height: 0.9rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
        }

        .radios {
            width: 100%;
            height: 100%;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            border: none;
            background: url("../../image/danxuan.png") no-repeat left;
            background-size: 0.4rem 0.4rem;
            padding-left: 0.6rem;
            margin-right: 0.2rem;
        }

        input[type="radio"] {
            display: none;
        }



        .radioStyle {
            width: 0.2rem;
            height: 0.2rem;
        }

        .payWay_Box label {
            line-height: 1rem;
            position: relative;
            border-bottom: 0.01rem solid#e2e2e2;
            height: 100%;
            display: block;
            box-sizing: border-box
        }

        .payWay_Box label:last-child {
            border-bottom: 0;
        }

        .radioStyle {
            width: 0.44rem;
            height: 0.44rem;
            display: inline-block;
            background: #fff;
            border-radius: 50%;
            box-sizing: border-box;
            position: absolute;
            z-index: 1;
            right: 0;
            margin-top: -0.22rem;
            top: 50%;
            border: 0.01rem solid#656565;
        }

        input[type=radio]:checked+.radioStyle {
            border: 0;
            background: url("../../image/checknew.png") center center no-repeat;
            background-size: 100% 100%;
        }

        #agreementinput {
            opacity: 0;
            position: absolute;
            z-index: 2;
            width: 100%;
            height: 100%;
            margin: 0;
            border: 0;
            left: 0;
            top: 0
        }

        .rementLabel {
            display: inline-block;
            box-sizing: border-box;
            position: relative;
            line-height: 0.9rem;
        }

        .rementLabel .agreement_style {
            width: 100%;
            height: 100%;
            position: absolute;
            z-index: 1;
            margin: 0;
            border: 0.02rem solid#656565;
            border-radius: 0.04rem;
            left: 0;
            top: 0;
        }

        .rementLabel>span:last-child {
            font-size: 0.27rem;
            vertical-align: middle
        }

        .rementLink {
            color: #ffd203;
            line-height: 0.9rem
        }

        .rentBtn {
            display: inline-block;
            width: 6.9rem;
            background: #ffd203;
            color: #181818;
            height: 0.88rem;
            border-radius: 0.1rem;
            line-height: 0.88rem;
            text-decoration: unset;
            font-size: 0.28rem;
            text-align: center;
        }

        .rementLabel .agreement_style_checked {
            width: 100%;
            height: 100%;
            position: absolute;
            z-index: 1;
            margin: 0;
            border: 0.02rem solid#ffd203;
            border-radius: 0.04rem;
            left: 0;
            top: 0;
        }

        .rementLabel .agreement_style_checked:after {
            content: '';
            width: 0.12rem;
            height: 0.12rem;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-left: -0.06rem;
            margin-top: -0.08rem;
            background: transparent;
            border: 2px solid #ffffff;
            border-top: none;
            border-right: none;
            z-index: 2;
            -webkit-border-radius: 0;
            border-radius: 0;
            -webkit-transform: rotate(-45deg);
            transform: rotate(-45deg);
            border-color: #ffd203;
        }

        .notAgree {
            background: #e6e6e6;
        }

        #showother {
            position: absolute;
            display: block;
            width: auto;
            height: auto;
            top: 0.6rem;
            right: -3.6rem;
            background-color: #ffd100;
            border-radius: 0.1rem;
            font-size: 0.22rem;
            padding: 0.2rem;
            font-weight: 600;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            z-index: 100;
        }

        #showother::after {
            position: absolute;
            top: -0.26rem;
            left: 0.55rem;
            display: block;
            content: '';
            width: 0;
            border-width: 0.15rem 0.15rem 0.15rem 0.15rem;
            border-style: solid;
            border-color: transparent transparent #ffd100 transparent;
            z-index: 100;
        }

        #showother span:last-of-type {
            font-size: 0.22rem;
            margin-top: 0.1rem;
        }

        .total {
            padding: 0rem;
            border-top: 0.01rem solid #e5e5e5;
            height: 0.9rem;
            width: calc(100% - 0.58rem);
            margin: 0 auto;
        }

        .total .payMoney {
            padding-right: 0.1rem
        }

        .total span {
            line-height: 0.9rem
        }

        .total .getAllPower {
            font-size: 0.28rem;
            float: right;
        }

        .toastMore {
            height: 0.66rem;
            line-height: 0.66rem;
            background: #FFEFD2;
            color: #EBA933;
            font-size: 0.22rem;
            padding: 0 0.24rem;
        }

        .pays {
            padding: 0 0.24rem;
            background: #fff;
        }

        .pays label {
            display: block;
            overflow: hidden
        }

        .pays .name {
            line-height: 0.34rem;
            float: left;
            padding-left: 0.22rem;
        }

        .pays .payOne {
            padding: 0.3rem 0;
            border-bottom: 0.01rem solid #eee;
        }

        .pays .payOne:last-child {
            padding: 0.2rem 0;
            border: 0
        }

        .pays .checkSt {
            display: block;
            width: 0.34rem;
            height: 0.34rem;
            border: 0.01rem solid#d4cfcf;
            border-radius: 50%;
            float: left;
            box-sizing: border-box;
        }

        .pays label input:checked+.checkSt {
            background: url("../../image/checknew.png") center center no-repeat;
            background-size: 100% 100%;
            border: 0;
        }

        #addCs {
            display: block;
            padding: 0.2rem 0;
            padding-left: 0.6rem;
            background: url('../../image/danxuan.png') left 0.2rem no-repeat;
            background-size: 0.4rem 0.4rem;
        }

        .choose-item>span:last-child {
            height: auto;
        }

        #addCs .bhpycs {
            color: #999999;
            font-size: 0.24rem;
            padding-top: 0.08rem;
            padding-left: 0rem;
            position: relative;
            display: inline-block;
            width: 100%;
            box-sizing: border-box
        }

        #addCs .isOpenOrclose {
            color: #FFBD3C;
        }

        #addCs .bhpycs.isHide {
            display: none;
        }

        input[name="moeney"]:checked+label {
            background: url("../../image/add_input_checkstyle.png") no-repeat left;
            background-size: 0.4rem 0.4rem;
            padding-left: 0.6rem;
        }

        input[name="moeney"]:checked+#addCs {
            background: url("../../image/add_input_checkstyle.png") left 0.2rem no-repeat;
            background-size: 0.4rem 0.4rem;
            padding-left: 0.6rem;
        }
    </style>
</head>

<body>
    <div>
        <ul class="showDetail">
            <li style="height: 1rem;">
                <p>
                    <span>转让名称</span>
                    <span class="machineName">活期_3T起租（限租60T)</span>
                </p>
            </li>
            <li style="height: 1rem;">
                <p style="border-top:1px solid #e5e5e5;">
                    <span>
                        原合约金额
                    </span>
                    <span class="uesePhone">--</span>
                </p>
            </li>
            <li class="takePrice" style="height: 1rem;display: none;">
                <p style="border-top:1px solid #e5e5e5;">
                    <span>
                        承接合约包金额
                    </span>
                    <span class="oldPrice">--</span>
                </p>
            </li>
            <li id="showButton" style="border-top: 0.2rem solid #f7f7f7;">
                <p>
                    <span>
                        转让算力
                    </span>
                    <span class="rentNumber rightData flex"
                        style="flex:1;display: flex;display: -webkit-flex;justify-content: flex-end;">
                        <input type="number" pattern="[0-9]*" name="gotransfer" id="inputNumber"
                            oninput="this.value=this.value.replace(/\D/g, '')" placeholder="请输入转让算力" style="flex: 1;">
                        <span class="disButton">份</span>
                    </span>
                </p>
            </li>
            <li style="height: auto;">
                <p
                    style="border-top:1px solid #e5e5e5;height: 0.63rem;justify-content: flex-end;font-size:0.22rem;font-family:PingFang SC;font-weight:500;color:rgba(38,38,38,1);align-items: center;">
                    <span style="font-size: 0.26rem;">
                        BTC算力：<span class="showBtcpower">0</span>T
                    </span>
                    <span class="getAllPower rightData flex bhpPowerNum" style="margin-left: 0.47rem;display: none;">
                        BHP参配算力：
                        <span class="payBhpUnit">
                            0
                        </span>T
                    </span>
                </p>
            </li>
            <li style="border-top: 0.2rem solid #f7f7f7;">
                <p>
                    <span>
                        分币比例
                    </span>
                    <span class="getAllPower rightData flex disRate"
                        style="height: 100%; flex:1;display: flex;display: -webkit-flex;justify-content: flex-end;color: #EE3333;">
                        0.01 %
                    </span>
                </p>
            </li>
            <li>
                <p style="border-top:1px solid #e5e5e5;">
                    <span>
                        转让单价
                    </span>
                    <span class="getAllPower rightData flex"
                        style="height: 100%; flex:1;display: flex;display: -webkit-flex;justify-content: flex-end;">
                        <input type="text"
                            style="text-align: right;flex:1;height:80%;font-size: 0.26rem;padding-right:0.2rem;box-sizing:border-box;"
                            id="sendPrice" name="gotransfer" placeholder="请输入转让价格"
                            οnkeyup="this.value=this.value.replace(/\D/g,'')"
                            onafterpaste="this.value=this.value.replace(/\D/g,'')">
                        <span class="payUnit">
                            CNY/T
                        </span>
                    </span>
                </p>
            </li>
            <li style="border-top:0.01rem solid #e5e5e5;height: 0.74rem;font-size: 0.22rem;background: #f7f7f7;">
                <p style="color: #696969;font-size: 0.22rem;">
                    <span class="hidechange">
                        转让汇率:
                        <span class="changeUsdt" style="color: #696969;font-size: 0.22rem;">
                            <!-- 1 CNY = 1 CNY -->
                        </span>
                    </span>
                    <span
                        style="width: 50%;color: #696969;display: flex;display: -webkit-flex;align-items: center;justify-content: flex-end;font-size: 0.22rem;">
                        <span class="priceText" style="margin-right: 0.05rem">
                            公允价格
                        </span>
                        <span class="uesePhone" style="color: #696969;font-size: 0.22rem;">
                            3000 CNY/T
                        </span>
                    </span>
                </p>
            </li>
            <li id="showtextTips" style="height: auto;padding:0;display: none;border: none;">
                <p
                    style="display: flex;display:-webkit-flex;flex-direction:column;align-items:flex-start;padding-right: 0;">
                    <span
                        style="width:100%;height: 0.76rem;line-height: 0.76rem;background-color: #fee4b9;color: #ffa903;padding-left: 0.24rem;font-size: 0.24rem;box-sizing: border-box;">
                        转让价格高于<span class="usdtText" style="color: #ffa903;font-size:0.24rem;">公允价格</span>,将收取1%的手续费
                    </span>
                <form action="" method="get" class="choose-item" id="choose-item">
                    <span class="isShowCny"
                        style="display: flex;display:-webkit-flex;align-items: center;border-bottom: 1px solid #e5e5e5;">
                        <input name="moeney" type="radio" value="CNY" id="cnychoose" checked />
                        <label class="radios" for='cnychoose'>
                            <span class="chooseOther">CNY</span>&nbsp;&nbsp;支付手续费
                        </label>
                    </span>
                    <span style="display: flex;display:-webkit-flex;align-items: center;">
                        <input name="moeney" type="radio" value="BHP" id="ethchoose" />
                        <label class="radios" for='ethchoose' id="addCs">
                            <span class="txt">BHP&nbsp;&nbsp;五折优惠支付手续费</span>
                            <span class=" bhpycs isOpenBhpay isHide">BHPay账户 <span class="bhpayNum">
                                    <!--153****2222--></span></span>
                            <span class=" bhpycs isHide toOpenBy">未关联Bhpay账户</span>
                            <span class=" bhpycs isOpenOrclose isHide toCloseBy">未开通BHPay快捷支付，去开通 &nbsp;></span>
                        </label>
                    </span>
                </form>
                </p>
            </li>
        </ul>
        <p class="total">
            <span>总额(不含手费)</span>
            <span class="getAllPower">
                <span class="payMoney">0.00</span><span class="dw">BCNY</span>
            </span>
        </p>
        <div class="tipeText" style="height: auto;padding:0.3rem;box-sizing: border-box;line-height: 0.46rem;
            color: #595959;font-size: 0.24rem;width: calc( 100% - 0.6rem );margin: 0 auto;background: #fafafa;">
            <!-- 温馨提示: 1. 转让价格在公允价格(包含公允价格)之内的，半小时未转让出，则平台以公允价格回收<br> -->
            1. 转让价格高于公允价格的，转让时效超过24小时未转让成功，则归还转让人<br>
            2. 当前合约包一旦发起转让，将停止挖矿产生收益行为，请谨慎发起转让<br>
            3. 10:30 - 11:30 为产出发放时间， 建议每日11:30后发起转让申请。<br>
            4..转让成功后，余额请在【我的资产】中查看
        </div>
        <div style="padding-bottom: 0.45rem;padding-top: 0.25rem;padding-left: 0.3rem;">
            <p style="text-align: left;">
                <label class="rementLabel">
                    <span
                        style="position: relative;width: 0.3rem;height: 0.3rem;display: inline-block;vertical-align: middle;margin-right: 0.05rem">
                        <input type="checkbox" id="agreementinput" name="agreement">
                        <span class="ag_checkedstyle agreement_style"></span>
                    </span>
                    <span style="vertical-align: middle;font-size: 0.27rem;">我同意</span>
                    <span class="rementLink">《云算力在线转/受让撮合服务协议》</span>
                </label>
            </p>
            <p>
                <a href="javascript:;" class="rentBtn notAgree" style="text-decoration:none;">立即转让</a>
            </p>
        </div>
    </div>

    <script src="../../script/autosize.js"></script>
    <script src="../../script/jquery_three_two_one.js"></script>
    <script src="../../script/fastclick.js"></script>
    <script src="../../script/app.js"></script>
    <script>
        apiready = function () {
            var app = new APP();
            // app.headerMap(function (ret) {
            //     var param = {
            //         dtype: "dialog38"
            //     };
            //     app.dialog(param);
            // });
            var account = app.getAccount();
            var machineId = api.pageParam.machineId; //机器ID
            var machineDetail = api.pageParam.Matchine //机器详情
            var maxInputPower = app.accMul(machineDetail.num, machineDetail.basePower) + ".0"; //inpput输入最大值
            var maxInputPowerOld = app.accMul(machineDetail.rawNum, machineDetail.basePower) + ".0"; //outInpput
            var maxTanfer = machineDetail.num; //最大转让份数
            var rentMoney = 0; //单份租用金额
            var agreementinput = false; //是否同意协议
            var userTransferData = {}; //确认转让提交数据
            var usdtPrice = api.pageParam.usdtPrice; //usdt价格
            // console.log("//////////" + usdtPrice);
            var constract_id = ""; //协议ID
            var reTwo = /([0-9]+\.[0-9]{0,2})[0-9]*/;
            var refour = /([0-9]+\.[0-9]{0,4})[0-9]*/;
            if (app.ST == "ios") {
                $("input").click(function () {
                    $(this).focus().select(); //保险起见，还是加上这句。
                });
            }
            var btcpower = machineDetail.computingPower;//btc单份分配算力
            var bhppower = machineDetail.bhpPower;//bhp单份分配算力
            var transferNum = machineDetail.num;
            function changePower(btcpower, bhppower, transferNum) {
                var btcTranferPower = app.accMoreMul(btcpower, transferNum);
                var bhpTranferPower = app.accMoreMul(bhppower, transferNum);
                $(".showBtcpower").text(btcTranferPower);
                if (machineDetail.isBhpPos == 1) {
                    $(".bhpPowerNum").show();
                    $(".payBhpUnit").text(bhpTranferPower);
                }
            }
            changePower(btcpower, bhppower, transferNum);
            app.ajaxPro({
                url: "transfer/contract",
                values: {
                    token: account.token
                },
                openFlower: true
            }, function (ret) {
                if (ret.code == 200) {
                    constract_id = ret.data.id;
                    $(".rementLink").text("《" + ret.data.name + "》");
                    $(".rementLink").click(function (e) {
                        var param = {
                            dtype: "dialog39",
                            data: {
                                oriderID: machineDetail.order_id,
                                title: ret.data.name,
                                orderText: ret.data.content,
                                btns: [{
                                    name: "我已阅读并同意",
                                    event: "okRentMachine"
                                }],
                                extra: {}
                            }
                        };
                        app.dialog(param);
                        e.stopPropagation();
                    });
                }
            });
            var openBhpaySts = 0;//bhpay支付状态，为1才可以选择支付
            function getBhpaySts() {
                app.ajaxPro({
                    url: "bhpay/checkpay",
                    values: {
                        token: account.token
                    },
                    openFlower: true
                }, function (ret) {
                    if (ret) {
                        var code = ret.code;
                        openBhpaySts = code;
                    }
                    if (ret.code == 542) {
                        //未关联BHPay账户，去关联
                        $(".toCloseBy").removeClass('isHide').siblings('p').addClass('isHide');
                        return
                    }
                    if (ret.code == 543) {
                        //未开通BHPay支付，去开通
                        $(".toCloseBy").removeClass('isHide').siblings('p').addClass('isHide');
                        return
                    }
                    if (ret.code == 200) {
                        $(".isOpenBhpay").removeClass('isHide').siblings('p').addClass('isHide');
                        $(".bhpayNum").text(ret.data.mobile);
                    }
                })
            };
            getBhpaySts();
            $(".disRate").text(app.accMul(machineDetail.distributionRate, 100) + "%");
            $(".isOpenOrclose").unbind('click').click(function (e) {
                //跳转开通bhpay快捷支付
                e.stopPropagation();
                // var cointypecontract = {
                //     page: "common/headerwin",
                //     name: "relateaccount_headerwin",
                //     param: {
                //         subpage: "mine/relateaccount",
                //         name: "relateaccount",
                //         title: "关联BHPAY账户"
                //     }
                // };
                // var recoinNumber = JSON.stringify(cointypecontract);
                // app.goPushPage(recoinNumber);
                var goCerfition = {
                    name: "relateaccount",
                    subpage: "mine/relateaccount",
                    title: "关联BHPAY账户",
                    param: {
                        pageName: "relateaccount",
                    }
                };
                app.setNavBarAttr(goCerfition);
            });
            function goOpenBhpay() {
                //弹窗 未关联Bhpay账户
                var param = {
                    dtype: "dialog54",
                    data: {
                        title: '提示',
                        text: '未关联BHPay账户，请至[我的-关联BHPay账户]进行关联并开通快捷支付',
                        confirm: 'confirm',
                        confirmtxt: '我知道了',
                        stopPropagation: true,//阻止点击body冒泡
                    }
                };
                app.dialog(param);
            }
            $("input[name='moeney']").unbind('input porpertychange').bind('input porpertychange', function () {
                if ($(this).is(":checked") && $(this).val() == "BHP") {
                    if (openBhpaySts == -1) {
                        goOpenBhpay();
                    }
                }
            });
            app.listen('changeBhpaySts', function () {
                //更改bhpay快捷支付状态，刷新页面
                app.reload();
            });
            $(".machineName").text(machineDetail.productName);
            $(".endTime").text(machineDetail.end_time);
            var residueday = 0;
            if (machineDetail.switch_validity_days > machineDetail.remaining_time) {
                residueday = app.numSub(machineDetail.switch_validity_days, machineDetail.remaining_time);
            } else {
                residueday = 0;
            }
            $(".showAllday").text("承接后合约包剩余期限(" + machineDetail.switch_validity_days + "天)");
            $(".showAddDay").text(machineDetail.remaining_time + "天(合约包剩余期限)+" + residueday + "天(平台赠送)");
            $("#showDialog").click(function () {
                $("#showother").show();
            })
            $("#showother").click(function () {
                $(this).hide();
            })
            if (machineDetail.paymentCurrencyCode == "USDT") {
                $(".usdtText").text("初始订单价格");
                $(".priceText").text("初始订单价格");
                $(".changeUsdt").text("1 USDT ≈ " + usdtPrice + " CNY");
                $(".chooseOther").text(machineDetail.paymentCurrencyCode);
                $("#cnychoose").val("USDT");
            }
            else {
                $(".usdtText").text("公允价格");
                $(".priceText").text("公允价格");
                $(".changeUsdt").text("1 CNY = 1 OTC余额");
            }
            if (machineDetail.state2 == 2) {
                $(".takePrice").show();
            }
            var getDev = app.accDiv(machineDetail.rawTotalDeposit, maxInputPowerOld);
            var getDevNew = maxInputPower > 1 ? String(app.accDiv(machineDetail.totalDeposit, maxInputPower)) : String(machineDetail.continueTotalDeposit);
            if (machineDetail.paymentCurrencyCode == "USDT") {
                getDev = app.sliceNum(getDev, 4);
                getDevNew = app.sliceNum(getDevNew, 4);
            } else {
                getDev = app.sliceNum(getDev, 2);
                getDevNew = app.sliceNum(getDevNew, 2);
            }
            rentMoney = Number(getDev);
            $(".uesePhone").text(getDev + " " + (machineDetail.rawPaymentCurrencyCode == "BCNY" ? "CNY" : machineDetail.rawPaymentCurrencyCode) + "/T");
            $(".oldPrice").text(getDevNew.replace(refour, "$1") + " " + (machineDetail.rawPaymentCurrencyCode == "BCNY" ? "CNY" : machineDetail.rawPaymentCurrencyCode) + "/T");
            $(".payUnit").text((machineDetail.paymentCurrencyCode == "BCNY" ? "CNY" : machineDetail.paymentCurrencyCode) + "/T");
            $(".dw").text(machineDetail.paymentCurrencyCode == "BCNY" ? "CNY" : machineDetail.paymentCurrencyCode);
            $("#inputNumber").on("input porpertychange", function () {
                var thisVal = Number($(this).val());
                if (thisVal > maxTanfer) {
                    thisVal = maxTanfer;
                    $(this).val(maxTanfer);
                }
                changePower(btcpower, bhppower, thisVal);
            });
            //当输入框输入数字时
            var inputStartTime = 0; //开始输入第一个数字的时间
            $("#sendPrice").on("input porpertychange", function (event) {
                inputStartTime = event.timeStamp;
                setTimeout(function () {
                    if (inputStartTime - event.timeStamp == 0) {
                        var thisVal = $("#sendPrice").val();
                        if (thisVal <= rentMoney) {
                            $("#showtextTips").hide();
                        } else {
                            $("#showtextTips").show();
                        }
                        if (machineDetail.paymentCurrencyCode == "USDT") {
                            $("#sendPrice").val(thisVal.replace(refour, "$1"));
                        } else {
                            $("#sendPrice").val(thisVal.replace(reTwo, "$1"));
                        }
                    }
                }, 200)
            });
            $("input[name='gotransfer']").on("input porpertychange", function () {
                var priceInput = $("#sendPrice").val();
                var powerInput = $("#inputNumber").val();
                var totalMoney = String(app.accMul(app.accMul(powerInput, priceInput), machineDetail.basePower));
                if (machineDetail.paymentCurrencyCode == "USDT") {
                    $(".payMoney").text(totalMoney.replace(refour, "$1"));
                } else {
                    $(".payMoney").text(totalMoney.replace(reTwo, "$1"));
                }
            });
            $(".rementLabel").click(function () {
                if (agreementinput == false) {
                    agreementinput = true;
                    $(".ag_checkedstyle").removeClass('agreement_style').addClass(
                        'agreement_style_checked');
                    $(".rentBtn").removeClass('notAgree')
                } else {
                    agreementinput = false;
                    $(".ag_checkedstyle").removeClass('agreement_style_checked').addClass(
                        'agreement_style');
                    $(".rentBtn").addClass('notAgree')
                }
            });
            //点击转让
            $(".rentBtn").bind('tap click', function () {
                var thisPrice = $("#sendPrice").val();
                var thisNumber = $("#inputNumber").val();
                var payChoose = $("input[name='moeney']:checked").val();
                var oldPayMethod = machineDetail.rawPaymentCurrencyCode;
                if (!constract_id) return;
                if (!thisNumber) {
                    app.toast("请输入转让算力");
                    return
                }
                if (!thisPrice) {
                    app.toast("请输入价格");
                    return
                }
                if (openBhpaySts == -1 && payChoose == "BHP") {
                    goOpenBhpay();
                    return;
                }
                if (agreementinput == true) {
                    userTransferData = {
                        token: account.token,
                        trade_password: "",
                        poundage_type: payChoose,
                        order_id: machineId,
                        num: thisNumber,
                        amount: thisPrice,
                        constract_id: constract_id,
                        basePower: machineDetail.basePower
                    }
                    var reduceNum = {};
                    app.ajaxPro({
                        url: "order/return-loss",
                        values: {
                            token: account.token,
                            order_id: machineId,
                            num: thisNumber
                        },
                        openFlower: true
                    }, function (ret) {
                        if (ret.code == 200) {
                            reduceNum = ret;
                            app.ajaxPro({
                                url: "transfer/get-poundage",
                                values: {
                                    token: account.token,
                                    poundage_type: payChoose,
                                    order_id: machineId,
                                    pay_currency: oldPayMethod,
                                    amount: app.accMul(thisPrice, machineDetail.basePower),
                                    num: thisNumber
                                },
                                openFlower: true
                            }, function (ret) {
                                if (ret.code == 200) {
                                    if (machineDetail.paymentCurrencyCode == "BCNY") {
                                        machineDetail.paymentCurrencyCode = "CNY";
                                    }
                                    if (ret.data.is_have_poundage == 0) {
                                        var param = {
                                            dtype: "dialog341",
                                            data: {
                                                tansferPower: app.accMul(thisNumber, machineDetail.basePower) + " T",
                                                transferBhpPower: app.accMul(thisNumber, bhppower) + " T",
                                                transferPrice: thisPrice + " " + machineDetail.paymentCurrencyCode + "/T",
                                                getMoney: app.accMoreMul(thisPrice, thisNumber, machineDetail.basePower) + " " + machineDetail.paymentCurrencyCode,
                                                transferTotal: app.accMoreMul(thisPrice, thisNumber, machineDetail.basePower) + " " + machineDetail.paymentCurrencyCode,
                                                tipsText: reduceNum.message
                                            },
                                            isHaveBhp: bhppower > 0 ? true : false
                                        };
                                    } else {
                                        if (payChoose != "USDT") {
                                            ret.data.amount = app.sliceNum(ret.data.amount, 2);
                                        }
                                        var param = {
                                            dtype: "dialog34",
                                            data: {
                                                tansferPower: app.accMul(thisNumber, machineDetail.basePower) + " T",
                                                transferBhpPower: app.accMul(thisNumber, bhppower) + " T",
                                                transferPrice: thisPrice + " " + machineDetail.paymentCurrencyCode + "/T",
                                                transferDrokerage: ret.data.cny + "CNY" + " = " + ret.data.amount + (payChoose == "BCNY" ? "CNY" : payChoose),
                                                getMoney: app.accMoreMul(thisPrice, thisNumber, machineDetail.basePower) + machineDetail.paymentCurrencyCode + " - " + ret.data.amount + (payChoose == "BCNY" ? "CNY" : payChoose),
                                                transferTotal: app.accMoreMul(thisPrice, thisNumber, machineDetail.basePower) + " " + machineDetail.paymentCurrencyCode,
                                                tipsText: reduceNum.message
                                            },
                                            isHaveBhp: bhppower > 0 ? true : false
                                        };
                                    }
                                    app.dialog(param);
                                } else {
                                    app.toast(ret.message);
                                }
                            })
                        } else {
                            app.toast(ret.message);
                        }
                    })
                }
            });
            app.listen("okRentMachine", function () {
                if (agreementinput == false) {
                    $(".rementLabel").click();
                }
            });
            app.listen("YesGoTransfer", function () {
                app.openFrame({
                    name: "keybord",
                    url: app.hd + "fisrt/keybord.html",
                    bgColor: "rgba(0,0,0,0.4)",
                    rect: {
                        x: 0,
                        y: 0,
                        w: app.W,
                        h: app.H
                    },
                    pageParam: {
                        userTransferData: userTransferData
                    }

                });
            })
            app.listen("transferDialog", function () {
                var param = {
                    dtype: "dialog38"
                };
                app.dialog(param);
            })
            app.listen("transferSe", function () {
                setTimeout(function () {
                    app.closeW();
                }, 1000);
            })
        };

    </script>
</body>

</html>